-- @owner: cr13
-- @date: 2024-10-15
-- @testpoint: inf特殊值作为触发器名，部分合理报错

--step1:创建源表 expect:成功
drop table if exists t_tbl_0056_01;
CREATE TABLE t_tbl_0056_01(id1 INT, id2 INT, id3 INT);

--step2:创建触发表 expect:成功
drop table if exists t_tbl_0056_02;
CREATE TABLE t_tbl_0056_02(id1 INT, id2 INT, id3 INT);

--step3:创建触发器函数 expect:成功
CREATE OR REPLACE FUNCTION f_func_0056() RETURNS TRIGGER AS
$$
DECLARE
BEGIN
INSERT INTO t_tbl_0056_02 VALUES(NEW.id1, NEW.id2, NEW.id3);
RETURN NEW;
END
$$ LANGUAGE PLPGSQL;
/

--step4:创建INSERT触发器不带引号 expect:成功
CREATE TRIGGER binary_double_infinity BEFORE INSERT ON t_tbl_0056_01 FOR EACH ROW EXECUTE PROCEDURE f_func_0056();
/

--step5:清理环境 expect:成功
drop TRIGGER binary_double_infinity on t_tbl_0056_01 cascade;

--step6:创建INSERT触发器带双引号 expect:成功
CREATE TRIGGER "binary_double_infinity" BEFORE INSERT ON t_tbl_0056_01 FOR EACH ROW EXECUTE PROCEDURE f_func_0056();
/

--step7:清理环境 expect:成功
drop TRIGGER "binary_double_infinity" on t_tbl_0056_01 cascade;

--step8:创建INSERT触发器带单引号 expect:合理报错
CREATE TRIGGER 'binary_double_infinity' BEFORE INSERT ON t_tbl_0056_01 FOR EACH ROW EXECUTE PROCEDURE f_func_0056();
/

--step9:创建INSERT触发器带反单引号 expect:合理报错

CREATE TRIGGER `binary_double_infinity` BEFORE INSERT ON t_tbl_0056_01 FOR EACH ROW EXECUTE PROCEDURE f_func_0056();
/

--step10:清理环境 expect:成功
drop function if exists f_func_0056;
drop table if exists t_tbl_0056_01;
drop table if exists t_tbl_0056_02;
